﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MyTask.aspx.cs" Inherits="Task.MyTask" %>

<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>待办已办</title>
    <link href="css/style.css" rel="stylesheet" rev="stylesheet" />
    <link href="css/global.css" rel="stylesheet" rev="stylesheet" />
    <%--<link href="css/UI_Css/jquery-ui-1.8.17.custom.css" rel="stylesheet" rev="stylesheet" />--%>
    <script type="text/javascript" src="script/jquery-1.7.1.min.js"></script>
    <%--<script type="text/javascript" src="script/jquery-ui-1.8.17.custom.min.js"></script>--%>
    <script type="text/javascript" src="script/My97DatePicker_4.72/My97DatePicker/WdatePicker.js"></script>
    <script type="text/javascript" src="../Scripts/Comm.js"></script>
    <script type="text/javascript">
        $(function () {
            //            setTab(<%=Index %>);
            //            $('#tabs').tabs({ selected:<%=Index %>,
            //                select: function (event, ui) {
            //                    setTab(ui.index);
            //                }
            //            });
            ConvertTaskTab(0, 'CompleteTask', 'MyTask', 'li1', 'li0');
        });
//        function setTab(index) {
//            $("#li" + index).addClass("currently");
//            $("#li" + index).siblings().removeClass("currently");
//        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <%--<div id="right">
            <div class="place">
                <div class="placeleft">
                    <i></i>您当前的位置：<a href="">首页</a> >> <strong><b>待办已办</b></strong>
                </div>
                <a href="#" class="shuaxin">刷新</a>
            </div>
            <%--class="currently"  endDate.focus();--%>
        <%--</div>--%>
        <div class="listTable_1">
            <div class="tableTab">
                <ul >
                    <li class="currently" id="li0"   onclick="ConvertTaskTab(0,'CompleteTask','MyTask','li1','li0')"><a href="#MyTask" >
                        待办任务(<%=InboxCount%>)</a></li>
                    <li id="li1" onclick="ConvertTaskTab(1,'CompleteTask','MyTask','li1','li0')"><a href="#CompleteTask" >已办任务(<%=FinInboxCount%>)</a></li>
                </ul>
            </div>
            <div id="MyTask">
                <table border="0" cellpadding="0" cellspacing="0" class="listTable1">
                    <tr>
                        <td>
                            流程标题
                        </td>
                        <td>
                            业务编号
                        </td>
                        <td>
                            发送人
                        </td>
                        <td>
                            到达时间
                        </td>
                        <td>
                            任务状态
                        </td>
                        <td>
                            所属流程
                        </td>
                        <td rowspan="2">
                            <asp:Button ID="btnSearch" runat="server" Text="查询" CssClass="btnBg" OnClick="btnSearch_Click" />
                            <a href="#" class="searchLink" onclick="changeQuery('tbQuery')">
                                <br />
                                高级查询</a>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <input type="text" name="processName" id="processName" class="inputBorder" runat="server" />
                        </td>
                        <td>
                            <input type="text" name="bussinessID" id="bussinessID" class="inputBorder" runat="server" />
                        </td>
                        <td>
                            <input type="text" name="applicantUser" id="applicantUser" class="inputBorder" runat="server" />
                        </td>
                        <td>
                            <%--<input type="text" name="taskStartTime" id="taskStartTime" class="inputboder1 inputBg2" runat="server"  />--%><input
                                id="startDate" class="Wdate inputboder1" type="text" onfocus="var endDate=$dp.$('endDate');WdatePicker({onpicked:function(){},maxDate:'#F{$dp.$D(\'endDate\')}'})"
                                runat="server" />-<input id="endDate" class="Wdate" type="text" onfocus="WdatePicker({minDate:'#F{$dp.$D(\'startDate\')}'})"
                                    runat="server" />
                            <%--<input type="text" name="taskEndTime" id="taskEndTime" class="inputboder1 inputBg2" runat="server" />--%>
                        </td>
                        <td>
                            <asp:DropDownList ID="ddlTaskStatus" runat="server" CssClass="inputBorder" Height="22px">
                                <asp:ListItem Value="0">所有...</asp:ListItem>
                                <asp:ListItem Value="1">新任务</asp:ListItem>
                                <asp:ListItem Value="2">待处理</asp:ListItem>
                                <asp:ListItem Value="3">已超期</asp:ListItem>
                                <asp:ListItem Value="4">即将到期</asp:ListItem>
                            </asp:DropDownList>
                        </td>
                        <td>
                            <asp:DropDownList ID="ddlProcessCatalog" runat="server" CssClass="inputBorder" Height="22px">
                                <asp:ListItem Value="0">请选择...</asp:ListItem>
                                <asp:ListItem Value="1">内部协办</asp:ListItem>
                                <asp:ListItem Value="2">总公司发文</asp:ListItem>
                            </asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="7">
                            <table border="0" cellpadding="0" cellspacing="0" class="listTable2" id="tbQuery"
                                style="display: none">
                                <tr>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
                <table border="0" cellpadding="0" cellspacing="0" class="listTable3">
                    <tr>
                        <th>
                        </th>
                        <th>
                            <input name="" type="checkbox" value="" />
                        </th>
                        <th>
                            流程标题
                        </th>
                        <th>
                            业务编号
                        </th>
                        <th>
                            发送人
                        </th>
                        <th>
                            任务名称
                        </th>
                        <th>
                            到达时间
                        </th>
                        <th>
                            截止时间
                        </th>
                        <th>
                            任务状态
                        </th>
                        <th>
                            所属流程
                        </th>
                    </tr>
                    <asp:Repeater ID="rpMyTask" runat="server">
                        <ItemTemplate>
                            <tr>
                                <td>
                                    <img src="images/icon3.gif" />
                                </td>
                                <td>
                                    <input name="" type="checkbox" value="" />
                                </td>
                                <td>
                                    <%#Eval("SUMMARY").ToString().Substring(0,Eval("SUMMARY").ToString().IndexOf(';')) %>
                                </td>
                                <td>
                                    <%#Eval("SUMMARY").ToString().Substring(Eval("SUMMARY").ToString().IndexOf(';')+1) %>
                                </td>
                                <td>
                                    <%#Eval("TASKUSER") %>
                                </td>
                                <td>
                                    <%#Eval("STEPLABEL") %>
                                </td>
                                <td>
                                    <%#Eval("STARTTIME") %>
                                </td>
                                <td>
                                    <%#Eval("URGENTDUETIME") %>
                                </td>
                                <td>
                                    <%#GetTaskStatus((Eval("URGENTDUETIME") == null) ? "": Eval("URGENTDUETIME").ToString(), Eval("taskid").ToString())%>
                                </td>
                                <td>
                                    <%#Eval("PROCESSNAME") %>
                                </td>
                            </tr>
                        </ItemTemplate>
                    </asp:Repeater>
                    <tr>
                        <td colspan="6">
                            <webdiyer:AspNetPager ID="pagination" runat="server" Width="100%" meta:resourcekey="pagination"
                                CssClass="aspNetPager" CustomInfoTextAlign="Left" HorizontalAlign="Right" NextPageText="下一页"
                                PrevPageText="上一页" FirstPageText="首页" LastPageText="末页" OnPageChanging="pagination_PageChanging"
                                PageIndexBoxType="DropDownList" ShowCustomInfoSection="Left" NavigationToolTipTextFormatString='{0}'
                                NumericButtonTextFormatString="{0}">
                            </webdiyer:AspNetPager>
                        </td>
                    </tr>
                </table>
            </div>
            <%--我的已办--%>
            <div id="CompleteTask">
                <table border="0" cellpadding="0" cellspacing="0" class="listTable3">
                    <tr>
                        <td>
                            流程标题
                        </td>
                        <td>
                            业务编号
                        </td>
                        <td>
                            发送人
                        </td>
                        <td>
                            办结时间
                        </td>
                        <td>
                            任务状态
                        </td>
                        <td>
                            所属流程
                        </td>
                        <td rowspan="2">
                            <asp:Button ID="btnSearchCom" runat="server" Text="查询" CssClass="btnBg" OnClick="btnSearchCom_Click" />
                            <a href="#" class="searchLink" onclick="changeQuery('tbQueryFin')">
                                <br />
                                高级查询</a>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <input type="text" name="processNameCom" id="processNameCom" class="inputBorder"
                                runat="server" />
                        </td>
                        <td>
                            <input type="text" name="bussinessID" id="bussinessIDCom" class="inputBorder" runat="server" />
                        </td>
                        <td>
                            <input type="text" name="applicantUser" id="applicantUserCom" class="inputBorder"
                                runat="server" />
                        </td>
                        <td>
                            <%--<input type="text" name="taskStartTime" id="taskStartTime" class="inputboder1 inputBg2" runat="server"  />--%><input
                                id="startDateCom" class="Wdate inputboder1" type="text" onfocus="var endDateCom=$dp.$('endDateCom');WdatePicker({onpicked:function(){},maxDate:'#F{$dp.$D(\'endDateCom\')}'})"
                                runat="server" />-<input id="endDateCom" class="Wdate" type="text" onfocus="WdatePicker({minDate:'#F{$dp.$D(\'startDateCom\')}'})"
                                    runat="server" />
                            <%--<input type="text" name="taskEndTime" id="taskEndTime" class="inputboder1 inputBg2" runat="server" />--%>
                        </td>
                        <td>
                            <asp:DropDownList ID="ddlStatusCom" runat="server" CssClass="inputBorder" Height="22px">
                                <asp:ListItem Value="">所有</asp:ListItem>
                                <asp:ListItem Value="">正常完成</asp:ListItem>
                                <asp:ListItem Value="">超期完成</asp:ListItem>
                                <asp:ListItem Value="">终止</asp:ListItem>
                                <asp:ListItem Value="">已转交</asp:ListItem>
                            </asp:DropDownList>
                        </td>
                        <td>
                            <asp:DropDownList ID="ddlFinProcess" runat="server" CssClass="inputBorder" Height="22px">
                                <asp:ListItem Value="0">请选择...</asp:ListItem>
                                <asp:ListItem Value="1">内部协办</asp:ListItem>
                                <asp:ListItem Value="2">总公司发文</asp:ListItem>
                            </asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="7">
                            <table border="0" cellpadding="0" cellspacing="0" class="listTable2" id="tbQueryFin"
                                style="display: none">
                                <tr>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
                <table border="0" cellpadding="0" cellspacing="0" class="listTable3">
                    <tr>
                        <th>
                        </th>
                        <th>
                            <input name="" type="checkbox" value="" />
                        </th>
                        <th>
                            流程标题
                        </th>
                        <th>
                            业务编号
                        </th>
                        <th>
                            发送人
                        </th>
                        <th>
                            任务名称
                        </th>
                        <th>
                            办结时间
                        </th>
                        <th>
                            任务状态
                        </th>
                        <th>
                            所属流程
                        </th>
                    </tr>
                    <asp:Repeater ID="rpCompleteTask" runat="server">
                        <ItemTemplate>
                            <tr>
                                <td>
                                    <img src="images/icon3.gif" />
                                </td>
                                <td>
                                    <input name="" type="checkbox" value="" />
                                </td>
                            </tr>
                        </ItemTemplate>
                    </asp:Repeater>
                    <tr>
                        <td>
                            <asp:Button ID="btnCancel" runat="server" Text="撤销" class="btnBg" />
                        </td>
                        <td colspan="6">
                            <webdiyer:AspNetPager ID="pagination2" runat="server" Width="100%" meta:resourcekey="pagination"
                                CssClass="aspNetPager" CustomInfoTextAlign="Left" HorizontalAlign="Right" NextPageText="下一页"
                                PrevPageText="上一页" FirstPageText="首页" LastPageText="末页" OnPageChanging="pagination_PageChanging"
                                PageIndexBoxType="DropDownList" ShowCustomInfoSection="Left" NavigationToolTipTextFormatString='{0}'
                                NumericButtonTextFormatString="{0}">
                            </webdiyer:AspNetPager>
                        </td>
                    </tr>
                </table>
            </div>
        </div>
    </div>
    </form>
    <script type="text/javascript">
        var ddlProcessCatalog = $("#<%=ddlProcessCatalog.ClientID %>");
        var ddlFinProcess = $("#<%=ddlFinProcess.ClientID %>");
        ddlProcessCatalog.change(function () {
            $("#tbQuery").hide();
        });

        ddlFinProcess.change(function () {
            $("#tbQueryFin").hide();
        });

        function changeQuery(tablename) {
            var processID;
            if (tablename == "tbQuery") {
                processID = ddlProcessCatalog.val();
            } else {
                processID = ddlFinProcess.val();
            }
            if (processID == "0") {
                alert("请先确定您需查询任务的所属流程，再点击扩展条件增加业务字段查询条件，谢谢!");
            } else {


                if ($("#" + tablename + " tr").length > 1) {
                    //alert($("#tbQuery tr").length);
                    //alert($("#tbQuery tr").eq(0));
                    $("#" + tablename + " tr").each(function (i) {
                        if (i == 0 || i == 1) {
                            $(this).remove();
                        }
                    });
                }
                $.post("AjaxPage/GetExtCondition.aspx", { ProcessID: processID }, function (data) {
                    $("#" + tablename + " tr:last-child").before(data);
                });
                $("#" + tablename).toggle();
            }
        }
    </script>
</body>
</html>
